package cn.tedu.boot21.mapper;

import cn.tedu.boot21.entity.Emp;
import org.apache.ibatis.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Mapper
public interface EmpMapper {


    //#{xxx}这种写法会自动找到下面方法中同名的变量,如果没有同名变量则会进入到对象里面找到通过属性的get方法
    @Insert("insert into myemp values(null,#{name},#{sal},#{job})")
    public abstract void insert(Emp emp);

    @Select("select * from myemp")
    List<Emp> select();

    @Delete("delete from myemp where id=#{id}")
    void delete(int id);

    @Update("update myemp set name=#{name},sal=#{sal},job=#{job} where id=#{id}")
    void update(Emp emp);
}
